home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Rund1a.cpp < prev    next >
C/C++ Source or Header  |  1998-12-27  |  2KB  |  48 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Rund1a.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8.  
  9. int i;
  10. TForm1 *Form1;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm1::Button1Click(TObject *Sender)
  18. {
  19.   Canvas->Ellipse (30,30,180,180);
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::Button2Click(TObject *Sender)
  23. {
  24.   Timer1->Enabled = true;
  25.   i = 25;
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TForm1::FormCreate(TObject *Sender)
  29. {
  30.   Timer1->Enabled = false;
  31. }
  32. //---------------------------------------------------------------------------
  33. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  34. {
  35.    TRect Quelle, Ziel;
  36.    Timer1->Interval = 10;
  37.    Quelle = Rect(i, 25, i+155, 185);
  38.    Ziel = Rect (i+5, 25, i+160, 185);
  39.    Canvas->CopyRect(Ziel, Canvas, Quelle);
  40.    i = i + 5;
  41.    if (i>=ClientWidth-190) Timer1->Enabled = false;
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::Button3Click(TObject *Sender)
  45. {
  46.   Repaint ();
  47. }
  48. //---------------------------------------------------------------------------